Flash Article

Time Entry Application: Sample Workflow for Designing and Building Applications in Flash MX Professional 2004


Table of Contents

  1. Introduction
  2. Features of the Time Entry Application
  3. Installing the Time Entry Application
  4. Defining the Time Entry Application Framework

Defining the Time Entry Application Framework

When you build an application, it's important as a developer to define a framework that works for you. Will it be a form-based application? How will users navigate it? Is there one place for data access? How easily can you add a new screen? Where do you store your code?

When I built the Time Entry sample application I asked myself these questions and came up with the answers that made sense to me. I was particularly concerned with best practices that would make it easier for me to maintain and enhance my application in the future. Being a developer myself, I also wanted to make sure I was making use of new features such as forms, data integration, and the great enhancements made to ActionScript 2.0 that would make my life easier, such as external classes and compiler type checking.

Once I learned how to use these features (some of it by trial and error) I found that they did indeed make my life much easier. I was able to develop a workflow and use features that were similar to other development environments with which I was familiar.

The type of applications I was used to building utilized a form-based metaphor. They encapsulated my UI and data access logic into separate building blocks that exposed their logic through a public interface. The new forms feature in Flash MX Professional 2004 was an excellent fit. By playing around with different options in the UI and code I was able to build the exact type of framework I was used to.

Establishing a Forms Workflow

The Time Entry sample application provides several tabs to show different views of data (see Figure 2). Each data view is represented by a form within the application. I added an additional form, called a data module, to encapsulate the data integration logic for the application. Finally, I made use of the top-level application form as a container for my application logic and UI.

Outline of the form

Figure 2. Outline of the form

I chose a Hide Screen option for each of my forms so I would only have to see the form I selected within the authoring environment.

Each form within the application is associated with a class file that encapsulates all of the necessary logic. Each class file provides public methods for services that should be exposed to other classes. (For example, the TimeEntryData class exposes a public method called addTimeEntry for creating a new time entry within the DataSet.) Table 1 defines the UI and logic contained within each form.

Notice that the class files are contained within a package (com.macromedia.timeentry) located under the src folder. Therefore, a class path (./src) has been added to the project so that the compiler can find the ActionScript class files.

Table 1. Form Modules
Form UI Logic (Provided by the Class File)
application Contains the Time Entry graphic, menu bar, toolbar, and framework for hosting UI forms Sets up the menu and responds to menu and toolbar selections
dmTimeEntry Contains nonvisual data components Encapsulates all logic for accessing, managing, and resolving data to an external data source and the local computer
frmTimeEntry Contains UI for manipulating time-entry data, including filtering, sorting, and modifying data Contains logic for setting up the UI such as controlling columns within the DataGrid, and responds to button clicks such as add, remove, save, and load
frmProject Not implemented Not implemented
frmClient Not implemented Not implemented
frmLog Contains a TextArea for viewing data packets Exposes a simple interface that other modules can call to add entries into the log view

As you can see, this sample application demonstrates the use of forms and some of the data features in Flash MX Professional 2004. It also provides a simple framework that may be useful to others as they structure and build their own applications. Look at the source code, read the comments, and review the way I use data binding to control the flow of data between components. I encourage you to build additional versions of the sample ColdFusion component in a familiar language (such as ASP.NET, Java servlets, PHP). For detailed instructions on building a server-side object that works with the format of the RDBMSResolver, read Mark Rausch's article, "Updating a Database Using Flash MX Professional 2004," which walks you through the creation of RDBMSProcessor.cfc used in this sample application.